from django.db import models
from django.contrib.auth.models import User
import time

# wee models
class Wee(models.Model):
	title = models.CharField(max_length=50)
	user = models.ForeignKey(User)
	numLike = models.IntegerField(default=0)
	numDislike = models.IntegerField(default=0)
	datetime = models.DateTimeField(auto_now_add=True)
	image = models.ImageField(upload_to='/pictures',null=True,blank=True)
	text = models.TextField(null=True)

	def __unicode__(self):
		return self.title

class like(models.Model):
	wee = models.ForeignKey(Wee)
	user = models.ForeignKey(User)
	like = models.BooleanField(default=False)
	dislike = models.BooleanField(default=False)
	class Meta:
		unique_together = ("user","wee")

	def __unicode__(self):
		return self.user.username